package com.fr.web.platform;

import com.fr.base.FCloneable;
import com.fr.base.StringUtils;
import com.fr.base.XMLFileManager;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.report.io.xml.ReportXMLUtils;
import com.fr.report.script.core.FArray;
import java.io.Serializable;
import java.util.Iterator;

public class PlatformManager extends XMLFileManager
  implements Serializable, FCloneable
{
  public static final String XML_TAG = "PlatformManager";
  public PlatformControl platformControl = new PlatformNoControl();

  public PlatformControl getPlatformControl()
  {
    return this.platformControl;
  }

  public void setPlatformControl(PlatformControl paramPlatformControl)
  {
    this.platformControl = paramPlatformControl;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      String str1 = paramXMLableReader.getTagName();
      if (str1.equals("PMAttr"))
      {
        String str2 = paramXMLableReader.getAttr("names");
        Iterator localIterator = new FArray(str2.split(",")).iterator();
        this.platformControl = new PlatformPermissionAndAuthorityControl();
        while (true)
        {
          String str3;
          do
          {
            if (!(localIterator.hasNext()))
              return;
            str3 = (String)localIterator.next();
          }
          while (!(StringUtils.isNotBlank(str3)));
          this.platformControl.addAuthorityName(str3);
        }
      }
      if ("PlatformControl".equals(str1))
        this.platformControl = ((PlatformControl)ReportXMLUtils.readXMLable(paramXMLableReader));
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("PlatformManager");
    if (this.platformControl != null)
      ReportXMLUtils.writeXMLable(paramXMLPrintWriter, this.platformControl, "PlatformControl");
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return clone();
  }

  public String fileName()
  {
    return "platform.xml";
  }
}